<template>
  <div class="list-item" @click="linkDetail">
    <img class="icon" src="@/assets/common/text-icon.png" />
    <div class="item-content">
      <div class="title">
        {{ content.year }}年<span v-if="content.quarter">第{{ content.quarter }}季</span>度考核优秀等次名单
      </div>
      <div class="number-wrap">
        <div class="copy van-ellipsis">{{ content.deptNameTree || content.unitName }}</div>
        <div class="number">共 {{ content.num || content.count }} 人</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    content: {
      type: Object,
      default: () => {}
    }
  },
  methods: {
    linkDetail() {
      sessionStorage.setItem("resultInfo", JSON.stringify(this.content));
      let query = {
        year: this.content.year,
        quarter: this.content.quarter,
        is_year: 0,
        deptId: this.content.unitId
      };
      if (this.$route.query.type == "year") {
        query = {
          year: this.content.year,
          is_year: 1
        };
      }
      this.$router.push({
        path: "/appraisalResults/publicDetail",
        query
      });
    }
  }
};
</script>

<style scoped lang="scss">
.list-item {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  background: #fff;
  margin-bottom: 12px;
  border-radius: 8px;
  img {
    width: 30px;
    margin-right: 18px;
  }
  .item-content {
    flex: 1;
    .number-wrap {
      display: flex;
      align-items: center;
      justify-content: space-between;
      line-height: 17px;
      font-size: 12px;
      color: #a3a7ad;
      margin-top: 3px;
      .copy {
        width: 200px;
      }
      .number {
        width: 58px;
        text-align: right;
        color: #f60e36;
      }
    }
    .title {
      font-size: 14px;
      color: #333333;
      line-height: 20px;
    }
  }
}
</style>
